<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>微信分享Demo</title>
    <!--来自百度的cdn-->
    <script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <script src="../src/js/wxShareUtil.js"></script>
</head>
<body>
<script>
    var tokenUrl = "../weichatToken";//从服务器获取生成的token
    var shareUrl = location.href.split('#')[0];//本页
    var shareData = {
        title: '微信分享',
        desc: '这是一个微信分享',
        link: window.location.href,
        imgUrl: '插入图片链接',
        trigger: function (res) {

        },
        success: function (res) {
            //分享成功回调
        },
        cancel: function (res) {
            //分享取消回调
        }, fail: function (res) {
            //分享失败回调
        }
    };
    WShare.share(tokenUrl,shareUrl,shareData);
</script>
</body>
</html>